import 'package:flutter/material.dart';

class FilterBtn extends StatelessWidget {
  final bool isFilterExpanded;
  final GestureDragCancelCallback onTap;
  const FilterBtn(
      {super.key, required this.isFilterExpanded, required this.onTap});

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context).colorScheme;
    return Card(
      elevation: 4,
      // 圆角
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(5))),
      child: Container(
        height: 34,
        padding: const EdgeInsets.symmetric(horizontal: 8),
        decoration: BoxDecoration(
          color: theme.primaryContainer,
          borderRadius: BorderRadius.circular(5),
          shape: BoxShape.rectangle,
        ),
        child: InkWell(
          onTap: onTap,
          child: Icon(
            isFilterExpanded ? Icons.expand_less : Icons.expand_more,
            size: 20,
          ),
        ),
      ),
    );
  }
}
